package org.example.service;

/**
 * @BelongsProject: Dynamic-relationship-binding
 * @BelongsPackage: org.example.service
 * @Author: dengxiyan
 * @CreateTime: 2025/07/04  10:56
 * @Description: TODO
 * @Version: 1.0
 */
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

public interface EntityService<T> {
    T save(T entity);
    void delete(Long id);
    T findById(Long id);
    Page<T> findAll(Pageable pageable);
    List<T> findAll();
    T addRelation(Long sourceId, Long targetId, String relationField);
    void removeRelation(Long sourceId, Long targetId);
    Page<Object> findRelatedEntities(Long id, String relationField, Pageable pageable);
}
